package com.jwsoft.manager.core.gateway.controller;

import com.bifang.engine.protect.core.annotation.NoSignCrypto;
import com.jwsoft.manager.common.vo.eduSyncJhApplyError.EduSyncJhApplyErrorQueryVO;
import com.jwsoft.manager.core.integration.EduSyncJhApproveErrorIntegration;
import com.jwsoft.manager.common.vo.eduSyncJhApproveError.EduSyncJhApproveErrorVO;
import com.jwsoft.manager.common.vo.eduSyncJhApproveError.EduSyncJhApproveErrorKeyVO;
import com.jwsoft.manager.common.vo.eduSyncJhApproveError.EduSyncJhApproveErrorQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

import javax.servlet.http.HttpServletResponse;

/**
 * 金华市审核专库同步导入错误表网关
 *
 * @author zhiyuan
 * @since 2024-04-12
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "金华市审核专库同步导入错误表", description = "金华市审核专库同步导入错误表")
public class EduSyncJhApproveErrorController {

    @Autowired
    public EduSyncJhApproveErrorIntegration eduSyncJhApproveErrorIntegration;

    @Operation(summary = "金华市审核专库同步导入错误表分页查询",description = "金华市审核专库同步导入错误表分页查询")
    @PostMapping(value = "/syncJhApproveError0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduSyncJhApproveErrorVO>> getList(@RequestBody @Validated EduSyncJhApproveErrorQueryVO vo) {
        return AppResponse.successData(eduSyncJhApproveErrorIntegration.getList(vo));
    }

    @Operation(summary = "金华市审核专库同步导入错误表根据主键查询详情",description = "金华市审核专库同步导入错误表根据主键查询详情")
    @PostMapping(value = "/syncJhApproveError0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSyncJhApproveErrorVO> getById(@RequestBody @Validated EduSyncJhApproveErrorKeyVO vo) {
        return AppResponse.successData(eduSyncJhApproveErrorIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "金华市审核专库同步导入错误表新增",description = "金华市审核专库同步导入错误表新增")
    @PostMapping(value = "/syncJhApproveError0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSyncJhApproveErrorVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduSyncJhApproveErrorVO vo) {
        return AppResponse.successData(eduSyncJhApproveErrorIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "金华市审核专库同步导入错误表修改",description = "金华市审核专库同步导入错误表修改")
    @PostMapping(value = "/syncJhApproveError0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSyncJhApproveErrorVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduSyncJhApproveErrorVO vo) {
        return AppResponse.successData(eduSyncJhApproveErrorIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "金华市审核专库同步导入错误表删除",description = "金华市审核专库同步导入错误表删除")
    @PostMapping(value = "/syncJhApproveError0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduSyncJhApproveErrorKeyVO vo) {
        eduSyncJhApproveErrorIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "导出错误数据",description = "导出错误数据")
    @PostMapping(value = "/syncJhApproveError0007", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public void exportInfo(@RequestBody @Validated EduSyncJhApproveErrorQueryVO vo, HttpServletResponse response) {
        eduSyncJhApproveErrorIntegration.exportInfo(vo,response);
    }
}
